Private Sub cmdSave_Click()
If txtLast.Text = "" Then
MsgBox "Last Name Must Be Filled In"
End If
If optMale.Value = True Then
MsgBox "Employee is Male"
Else
MsgBox "Employee is Female"
End If If cboState.Text = "CA" Then MsgBox "Employee can sign up for Health Care" ElseIf cboState.Text = "AZ" Then MsgBox "Employee is eligible for Bonus Programmer" ElseIf cboState.Text = "NV" Then MsgBox "Employee is eligible for 401k"
End If
End Sub
The IIf( ) Function
The IIf() function allows you to combine an If...Then...Else statement into one line. The IIf() function accepts three parameters. If the first parameter evaluates to a True condition, the value of the second parameter is returned. If the first parameter evaluates to a False condition, the value of the third parameter is returned.
Heres the syntax:
IIF(<Cond1 is True>, <Return Exp1>, <Else Return Exp2>)